import java.io.*;
import java.util.*;

public class StopWordRemover {
	static HashSet<String> words = new HashSet<String>();
	
	static {
		try {
			FileInputStream fstream = new FileInputStream("stopwords.txt");
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			
			String strLine;
			
		    while ((strLine = br.readLine()) != null)   {
		    	words.add(strLine);
		    }
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static ArrayList<String> remove(String phrase) {
		StringTokenizer st = new StringTokenizer(phrase);
		ArrayList<String> list = new ArrayList<String>();
		while (st.hasMoreTokens()) {
			String token = st.nextToken();
			if (token.contains("?")) token = token.substring(0, token.indexOf("?"));
			if (!(words.contains(token.toLowerCase()))) list.add(token.toLowerCase());
		}
		
		
		return list;
	}
}
